<html  ng-app="myApp"  ng-controller="customersCtrl">
<head>
	<script src="http://code.angularjs.org/angular-1.0.1.min.js"></script>

    <script type="text/javascript" src="http://cdn.angularjs.cn/angularjs/1.3.0-beta.17/angular.js"></script>
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div  >

<form>
<input type="text" ng-model="user.name"   value="123">
    <input type="password" ng-model="user.password"   value="123">
{{showinfo}}

    <input type="button" ng-click="myform1()" value="登录">
</form>
</div>
<script>

    console.log(app);
//    var firstname={firstName}

//        alert();
        var app = angular.module('myApp', []);
        app.controller('customersCtrl', function ($scope, $http) {
            $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
            $scope.user = {"name": "11231", "password": "111"};
            $scope.showinfo="";
            console.log($scope.user);
            $scope.myform1 = function () {

                $http({
                    method: 'post', url: "{:U('Index/verify')}", params: $scope.user
                }).success(function (data1) {
console.log(data1.result);
               if(data1.result=="ok"){
                   $scope.showinfo="登录成功";
                   $scope.user = {"name": "", "password": ""};

               }else {
                   $scope.showinfo="登录失败,请核对用户名密码";

               }

                }

                );


            }
        });


</script>
</body>


</html>